//
//  UserAvgListCell.m
//  CoolTennisBall
//
//  Created by Coollang on 16/9/9.
//  Copyright © 2016年 CoolLang. All rights reserved.
//

#import "UserAvgListCell.h"
#import "UserDataModel.h"

@interface UserAvgListCell()
@property (weak, nonatomic) IBOutlet UILabel *forceSpeedLabel;// 正手拍速
@property (weak, nonatomic) IBOutlet UILabel *backSpeedLabel;// 反手拍速
@property (weak, nonatomic) IBOutlet UILabel *serveSpeedLabel;//发球拍速
@property (weak, nonatomic) IBOutlet UILabel *scoreLabel;// 运动评分
@property (weak, nonatomic) IBOutlet UILabel *durationLabel;//活跃时间
@property (weak, nonatomic) IBOutlet UILabel *weekSportLabel;//周运动量

// 国际化
@property (weak, nonatomic) IBOutlet UILabel *forceSpeedLab;
@property (weak, nonatomic) IBOutlet UILabel *backSpeedLab;

@property (weak, nonatomic) IBOutlet UILabel *serveSpeedLab;
@property (weak, nonatomic) IBOutlet UILabel *scoreLab;
@property (weak, nonatomic) IBOutlet UILabel *scroeUnitLab;

@property (weak, nonatomic) IBOutlet UILabel *durationLab;

@property (weak, nonatomic) IBOutlet UILabel *duractionUnitLab;
@property (weak, nonatomic) IBOutlet UILabel *weekSportLab;
@property (weak, nonatomic) IBOutlet UILabel *weekSportUnitLab;

@end

@implementation UserAvgListCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    [self configerLocalize];

}

- (void)configerLocalize {
    self.forceSpeedLab.text = NSLocalizedString(@"Forehand Swing Speed", @"正手拍速");
    self.backSpeedLab.text = NSLocalizedString(@"Backhand Swing Speed", @"反手拍速");
    self.serveSpeedLab.text = NSLocalizedString(@"Serve Ball Speed", @"发球球速");
    self.scoreLab.text = NSLocalizedString(@"Motor Score", @"运动评分");
    self.scroeUnitLab.text = NSLocalizedString(@"Report.Unit.Points", @"分");
    self.durationLab.text = NSLocalizedString(@"User.Active Time", @"活跃时间");
    self.duractionUnitLab.text = NSLocalizedString(@"User.h/wk", @"小时/周");
    self.weekSportLab.text = NSLocalizedString(@"Motion Frequency", @"运动量");
    self.weekSportUnitLab.text = NSLocalizedString(@"User.Shots/wk", @"球/周");
}

- (void)setDataModel:(UserDataModel *)dataModel {
    _dataModel = dataModel;
    
    self.forceSpeedLabel.text = [self checkFullString:dataModel.AvgList[@"ForceSpeed"]];
    self.backSpeedLabel.text =  [self checkFullString:dataModel.AvgList[@"BackSpeed"]];
    self.serveSpeedLabel.text =  [self checkFullString:dataModel.AvgList[@"ServeSpeed"]];
    self.scoreLabel.text =  [self checkFullString:dataModel.AvgList[@"Score"]];
    self.durationLabel.text =  [self checkFullString:dataModel.AvgList[@"Duration"]];
    self.weekSportLabel.text =  [self checkFullString:dataModel.AvgList[@"WeekSport"]];

}

- (NSString *)checkFullString:(NSString *)string {
    
    if (string.length <= 0) {
        return @"0";
    }
    return string;
}

@end
